﻿<#import "/spring.ftl" as spring/>
<#assign xhtmlCompliant = true in spring>

<#include "/tags/userNotification.ftl">
<#include "/tags/famousQuote.ftl">
<#include "/tags/goalSumTag.ftl">
<#include "/tags/userCompleteness.ftl">
<#include "/tags/userIntroTag.ftl">
<#include "/tags/friendList.ftl">
<#include "/tags/friendHintTag.ftl">
<#include "/tags/goalCloudTag.ftl">
<#include "/tags/updatedSinceTag.ftl">
<#include "/tags/DDMMYYYY.ftl">
<#include "/tags/likeTag.ftl">
<#include "/tags/entryAvatar.ftl">
<#include "/tags/userAvatar.ftl">
<#include "/tags/goalEntryTag.ftl">
<#include "/tags/commentTag.ftl">
<#include "/tags/commentBoxTag.ftl">
<#include "/tags/goalHowIDoneTag.ftl">
<#include "/tags/activitiesTag.ftl">
<#include "/tags/topGoalsTag.ftl">

<head>
	<link rel="stylesheet" type="text/css" href="${rc.contextPath}/styles/style_dev.css">	
	<link type="text/css" rel="stylesheet" href="${rc.contextPath}/scripts/cleditor/jquery.cleditor.css">
	<link rel="stylesheet" type="text/css" href="${rc.contextPath}/styles/jquery.alertbox.css">	
	<script type="text/javascript" src="${rc.contextPath}/scripts/cleditor/jquery.cleditor.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/common.entry.paging.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/editEntry.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/page.goalDetail.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/common.goalUtils.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/jquery.easing.1.3.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/scripts/jquery.alertbox.js"></script>
	<title>Mục tiêu ${data.goalDetail.title}'</title>
</head>

<!-- user's status and notifications -->
<@userNotification />  

<div id="infomation">
	<div id="left">
		
		<@famousQuote />
		<div class="w9">
			<div class="more1"></div>
		</div>
		<div id="memberdo">
			<div class="left">
				<div class="number">
					<#if data.goalStatus = 0>
						<#if data.numDoing = 1>
							Hiện tại chỉ có bạn đang thực hiện mục tiêu:
						<#else>
							Có <b>${data.numDoing - 1}</b> người đang cùng bạn thực hiện mục tiêu này
						</#if>
					<#else>
						Có <b>${data.numDoing}</b> người đang thực hiện mục tiêu này
					</#if>
				</div>
				<div class="goalname">
					<div class="text">${data.goalDetail.title}</div>
				</div>
        	</div>
			<div class="right">
				<center>
					<#if (data.userInSession??)>
						<#if (data.goalStatus == -1)>
							<a class="button" href="${rc.contextPath}/addSMARTGoal.html?goalId=${data.goalDetail.id}&type=new">Thực hiện</a>
						<#elseif (data.goalStatus == 0)>
							<a class="button" id="done_goal_button" rel="${data.goalDetail.id}">Hoàn thành</a>				
						</#if>
					<#else>
						<a href="/login.html" class="button">Thực hiện</a>
					</#if>
				</center>
			</div>
		</div>
		<div class="w3"></div>
      	<div id="allmemberdo">
      		<div class="left">Những thành viên thực hiện mục tiêu này</div>
	        <#if data.numDo gt 0>
	        	<a class="viewall" href="${rc.contextPath}/ajax/userList.html?type=USER_GOAL&goalId=${data.goalDetail.id}&pageId=1&total=${data.numDo}"></a>
	        </#if>
      	</div>
      	
      	<div id="listavatar">
      		<#if data.doUsers?? && data.numDo gt 0>
	      		<#list data.doUsers as user>
	      			<div class="avatar"><a title="${user.username}" href="/${user.username}"><img style="width: 50px; height: 50px;" src="<#if user.avatar?exists>${user.avatar}<#else>/images/avatar.png</#if>" alt="${user.username}" /></a></div>
	      		</#list>
	    	<#else>
	    		<div class="clear"></div>
	            <div class="NoGoal" style="padding-left:120px">
	            	<span class="icon_1 iconNoGoal"></span>
	                <p style="width:350px;">
	                	Hiện tại <b>chưa có thành viên nào</b> thực hiện mục tiêu này. Hãy thêm vào danh sách mục tiêu của bạn.
	                </p>
	            </div>
	    	</#if>
	  	</div>
		
		<div class="archtitle">
			<span style="float: left;"><@spring.message "page.userGoalDetail.recentEntry"/> <b style="color:#333333">"${data.goalDetail.title}"</b></span>
			<#if data.goalStatus gt -1>
				<span id="create_new_entry" rel="${data.goalDetail.id}">Viết bài viết mới</span>
			</#if>
		</div>
		<div class="w6"></div>
		
		<div id="entry_container">
		<#if data.recentEntries??>
			<#if data.recentEntries!?size == 0>
				<div class="clear"></div>
	            <div class="NoGoal" style="padding-left:120px">
	            	<span class="icon_1 iconNoGoal"></span>
	                <p style="width:350px;">
	                	Hiện tại <b>chưa có bài viết</b> cho mục tiêu này. Nếu bạn là người đang thực hiện mục tiêu này, hãy chia sẻ quá trình thực hiện đó.
	                </p>
	            </div>
			<#else>
				<#list data.recentEntries as entry>
					<#if (entry.entryType==1)>
					
					<!-- entry view -->
					<div class="archicle" rel="${entry.id}">
				    	<@goalEntry title=entry.title goalId=entry.goalId goalTitle=entry.goalTitle 
		      		  youLikeThis=entry.youLikeThis likeCount=entry.likeCount cheerCount=entry.cheerCount 
		      		  commentCount=entry.commentCount entryUpdatedSince=entry.updatedSince
				    				ownerName=entry.ownerName body=entry.body entryId=entry.id 
				    			      cheerCount=entry.cheerCount commentCount=entry.commentCount 
				    			      createdDate=entry.createdDate createdMonth=entry.createdMonth 
				    			      createdYear=entry.createdYear ownerAvatar=entry.ownerAvatar 
				    			      goalCreatedDate=entry.goalCreatedDate imgURL=entry.imgURL 
				    			      comments=entry.comments entryId=entry.id/>
				       
				     </div>
				     <!-- end of entry view -->
				     
				    <div class="w6"></div>				
				  	<#else>
				  		<div class="archicle">
	        				<@howIDone title=entry.title goalId=entry.goalId goalTitle=entry.goalTitle 
	        							youLikeThis=entry.youLikeThis likeCount=entry.likeCount cheerCount=entry.cheerCount 
	        							ownerName=entry.ownerName experience=entry.experience 
	        						   tookType=entry.tookType tookAmount=entry.tookAmount 
	        						   imgURL=entry.imgURL solution=entry.solution 
	        						   entryUpdatedSince=entry.updatedSince
									   tip=entry.tip resources=entry.resources entryId=entry.id 
									   cheerCount=entry.cheerCount commentCount=entry.commentCount goalCreatedDate=entry.goalCreatedDate
									   createdDate=entry.createdDate createdMonth=entry.createdMonth comments=entry.comments
									   createdYear=entry.createdYear ownerAvatar=entry.ownerAvatar />	        				
	      				</div>
				  	</#if>
				  	<#assign lastItem=entry/>
				</#list>
				<#if lastItem?? && lastItem.goalId??>
				<div id="next_page_scroll" class="goalEntryView;;${lastItem.goalId}" rel="${lastItem.sortedValue}" style="float:left"></div>
				<div id="scroll_loader" style="display: none; width: 100%; float: left; padding-top: 30px;">
					<center>
					<img src="/images/loader.gif"/>
					</center>
				</div>
				</#if>
			</#if>
		</#if> 
		</div>   
	</div>
	<!-- end of left zone-->
    
    <div id="right">
		<@goalSummary />        
  		<#if data.userInSession??>
	      	<@userCompleteness />
      		<@topGoals />
	  		<@userIntro/>
        	<@friendList username="${data.userInSession}" />
	        <@friendHint />
			<div class="clearthis"></div>
			<a href="http://igoal.vn/goal/view/335" >
				<img src="http://igoal.vn/photos/banner_baohanhtreem.png" style="margin-top:10px"/>
			</a>
        </#if>
	</div>
</div>
